import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;


public class CustomListener implements KeyListener {

	  private int lastKeyUsed = 39;
	
	  public void keyPressed(KeyEvent e) {
	    	dumpInfo("Pressed", e);
	  }
	
	  @Override
	  public void keyReleased(KeyEvent e) {
	    //dumpInfo("Released", e);
	  }
	
	  public void keyTyped(KeyEvent e) {
	    dumpInfo("Typed", e);
	  }
	
	  private void dumpInfo(String s, KeyEvent e) {
	    if(e.getKeyCode() == KeyEvent.VK_LEFT){
	  	  //moveLeft();
	    	lastKeyUsed = 37;
	    }else if(e.getKeyCode() == KeyEvent.VK_RIGHT){
	  	  //moveRight();
	    	lastKeyUsed = 39;
	    }else if(e.getKeyCode() == KeyEvent.VK_UP){
	  	  //moveUp();
	    	lastKeyUsed = 38;
	    }else if(e.getKeyCode() == KeyEvent.VK_DOWN){
	  	  //moveDown();
	    	lastKeyUsed = 40;
	    }else if(e.getKeyCode() == KeyEvent.VK_M){
	  	  //size+=10;
	  	  System.out.println("bigger");
	    }else if(e.getKeyCode() == KeyEvent.VK_N){
	  	  //size-=10;
	  	  System.out.println("smaller");
	    }
	  }

	  
	  public int getLastKeyUsed(){
		  return this.lastKeyUsed;
	  }
}
